# Find JRM's Sensors SDK
# This module defines
# JRMSENSORS_FOUND
# JRMSENSORS_INCLUDE_DIR
# On windows:
#   UNSUPPORTED AT THIS TIME
# On other platforms
#   JRMSENSORS_SIGSIMRT_LIBRARY
#   JRMSENSORS_SENSIMRT_LIBRARY
#

IF (UNIX)
    SET(JRMSENSORS_ARCH "linux")
#    MESSAGE(STATUS "Looking for JRM Sensors SDK!!")


    FIND_PATH(JRMSENSORS_INCLUDE_DIR SensorRender.h
        "$ENV{JRM_OSV_PATH}/include"
        "$ENV{JRM_SENSORS_PATH}/include"
        ${JRMSENSORS_DIR}/INCLUDE_DIRECTORIES
        $ENV{JRMSENSORS_DIR}/include
        /usr/local/include
        /usr/include
    )

    IF (JRMSENSORS_INCLUDE_DIR)
        MESSAGE(STATUS "Found JRMSENSORS_INCLUDE_DIR: ${JRMSENSORS_INCLUDE_DIR}")
    ELSE (JRMSENSORS_INCLUDE_DIR )
        MESSAGE(STATUS "Did not find JRMSENSORS_INCLUDE_DIR: ${JRMSENSORS_INCLUDE_DIR}")
    ENDIF (JRMSENSORS_INCLUDE_DIR)

    MACRO(FIND_JRMSENSORS_LIBRARY MYLIBRARY MYLIBRARYNAME)

        FIND_LIBRARY(${MYLIBRARY}
        NAMES ${MYLIBRARYNAME}
        PATHS
            ${JRM_OSV_PATH}/lib
            $ENV{JRM_OSV_PATH}/lib
            $ENV{JRM_OSV_PATH}
            $ENV{JRM_SENSORS_PATH}/lib
            /usr/local/lib
            /usr/local/lib64
            /usr/lib
            /sw/lib
            /opt/local/lib
            /opt/csw/lib
            /opt/lib
            /usr/freeware/lib64
            PATH_SUFFIXES
            ${MUSE_ARCH}
        )

    ENDMACRO(FIND_JRMSENSORS_LIBRARY MYLIBRARY MYLIBRARYNAME)

    FIND_JRMSENSORS_LIBRARY(JRMSENSORS_SIGSIMRT_LIBRARY "SigSimRT")
    FIND_JRMSENSORS_LIBRARY(JRMSENSORS_SENSIMRT_LIBRARY "SenSimRT")

    MESSAGE(STATUS "JRMSENSORS_INCLUDE_DIR: ${JRMSENSORS_INCLUDE_DIR}")
    MESSAGE(STATUS "JRMSENSORS_SIGSIMRT_LIBRARY: ${JRMSENSORS_SIGSIMRT_LIBRARY}")
    MESSAGE(STATUS "JRMSENSORS_SENSIMRT_LIBRARY: ${JRMSENSORS_SENSIMRT_LIBRARY}")

    SET(JRMSENSORS_FOUND FALSE)
    IF (JRMSENSORS_INCLUDE_DIR AND JRMSENSORS_SIGSIMRT_LIBRARY AND JRMSENSORS_SIGSIMRT_LIBRARY)
       SET(JRMSENSORS_FOUND TRUE)
    ELSE (JRMSENSORS_INCLUDE_DIR AND JRMSENSORS_SIGSIMRT_LIBRARY)
       MESSAGE(STATUS "Did not Find: ${JRMSENSORS_SIGSIMRT_LIBRARY}")
    ENDIF (JRMSENSORS_INCLUDE_DIR AND JRMSENSORS_SIGSIMRT_LIBRARY AND JRMSENSORS_SIGSIMRT_LIBRARY)

    IF (JRMSENSORS_FOUND)
       IF (NOT JRMSENSORS_FIND_QUIETLY)
          MESSAGE(STATUS "Found All JRMSENSORS LIBRARIES")
       ENDIF (NOT JRMSENSORS_FIND_QUIETLY)
    ELSE (JRMSENSORS_FOUND)
       IF (JRMSENSORS_FIND_REQUIRED)
          MESSAGE(FATAL_ERROR "Could not find All JRMSENSORS Libraries")
       ENDIF (JRMSENSORS_FIND_REQUIRED)
    ENDIF (JRMSENSORS_FOUND)

ENDIF (UNIX)
